#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.log.convert;

import ch.qos.logback.classic.pattern.ClassicConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;
import lombok.extern.slf4j.Slf4j;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 *@ClassName HostNameLogConfig
 *@Description TODO
 *@Author zhanglijun
 *@Date 2020/1/13 15:06
 *
 *${copyright}
 *Copyright (c) 2019. All Rights Reserved.
 */
@Slf4j
public class HostNameLogConfig extends ClassicConverter {
    @Override
    public String convert(ILoggingEvent iLoggingEvent) {

        try {
            return InetAddress.getLocalHost().getHostName();
        } catch (UnknownHostException e) {
            log.error("error info ",e);
        }
        return null;
    }
}
